<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Function</title>
</head>
<body>
<script>
  /* var fun1=new Function("a","b","alert(a);");
    fun1(3,4);
    function fun2(a,b)
    {
        alert(a+b);
    }
    fun2(3,4); */
    function add (){
           var sum = 0;
            for (var i = 0; i < arguments.length; i++) {
                sum += arguments[i];
            }
            return sum;
        }
    var sum = add(1,2,3,4);
    alert(sum);
</script>
</body>
</html>